From 5eab8ec160aa04edf6311cfd4089e32335ea36be Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 10 Nov 2014 09:22:04 -0800 Subject: [PATCH] Don't look at custom build targets for output locs They don't have any! We also care more about the other targets regardless. Closes #821 --- src/cargo/ops/cargo_rustc/mod.rs | 2 +- tests/test_cargo_compile_custom_build.rs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 6c461135e..89f4217da 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -71,7 +71,7 @@ pub fn rustc_version() -> CargoResult<(String, String)> { fn uniq_target_dest<'a>(targets: &[&'a Target]) -> Option<&'a str> { let mut curr: Option> = None; - for t in targets.iter() { + for t in targets.iter().filter(|t| !t.get_profile().is_custom_build()) { let dest = t.get_profile().get_dest(); match curr { diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index cd143bc9c..9c1c742c2 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -795,3 +795,21 @@ test!(code_generation { Hello, World! ", compiling = COMPILING, running = RUNNING).as_slice())); }) + +test!(release_with_build_script { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.5.0" + authors = [] + build = "build.rs" + "#) + .file("src/lib.rs", "") + .file("build.rs", r#" + fn main() {} + "#); + + assert_that(p.cargo_process("build").arg("-v").arg("--release"), + execs().with_status(0)); +}) -- 2.30.2